package com.qinglei.recoup.system.service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.qinglei.recoup.common.domain.CommonRes;
import com.qinglei.recoup.common.exception.RecoupException;
import com.qinglei.recoup.hmp.pojo.vo.healthReport.HealthReportDayVo;
import com.qinglei.recoup.system.domain.BedHealthBreathDailyData;
import com.qinglei.recoup.system.domain.BedHealthDailyStatistics;
import com.baomidou.mybatisplus.extension.service.IService;
import com.qinglei.recoup.system.domain.BedHealthQO;
import com.qinglei.recoup.system.domain.BedHealthShareParam;
import com.qinglei.recoup.system.pojo.*;
import org.apache.ibatis.annotations.Param;

import javax.servlet.http.HttpServletResponse;
import java.time.LocalDate;
import java.util.List;
import java.util.Map;

/**
 * @author syp
 */
public interface BedHealthDailyStatisticsService extends IService<BedHealthDailyStatistics> {

    /**
     * 查询老人健康数据
     * @param searchParam
     * @return
     */
    IPage<HealthVO> searchHealthPage(HealthSearchParam searchParam);

    /**
     * 导出健康数据(二期)
     * @param httpServletResponse
     * @param param
     */
    void exportHealthData(HttpServletResponse httpServletResponse, HealthSearchParam param);

    /**
     * 查询睡眠报告单天(二期)
     * @param param
     * @return
     */
    SleepReportVO getSleepReportOne(HealthDetailParam param);

    /**
     * 查询睡眠报告多天(二期)
     * @param param
     * @return
     */
    SleepReportMoreVO getReportMore(HealthDetailParam param);

    /**
     * 获取分享健康报告URL
     * @param param
     * @param baseUrl
     * @return
     */
    String getShareReportUrl(HealthDetailParam param, String baseUrl);

    /**
     * 查询睡眠报告单天(二期)
     * @param code
     * @return
     */
    SleepReportVO getSleepReportOne4Share(String code);

    /**
     * 查询睡眠报告多天(二期)
     * @param code
     * @return
     */
    SleepReportMoreVO getReportMore4Share(String code);

    /**
     * 从OSS导入一天的健康数据
     *
     * @param day 日期
     */
    void importDataFromOss(LocalDate day) throws RecoupException;

    BedHealthBreathDailyData getHealthReport(HealthDetailParam param);

    BedHealthBreathDailyData getHealthReport(HealthDetailParamV1 param);

    SleepReportVO getSleepReportOne4ShareWx(BedHealthShareParam bedHealthShareParam);

    SleepReportMoreVO getReportMore4ShareWx(BedHealthShareParam bedHealthShareParam);

    /**
     * 从OSS导入一天的健康数据V4
     *
     * @param day 日期
     */
    void importDataFromOssV4(LocalDate day) throws RecoupException;

    BedHealthDailyStatistics selectBedHealthDailyStatistics(BedHealthShareParam bedHealthShareParam);

    List<HealthRank> selectRank(LocalDate startDate);

    public  SleepReportVO getReportV4(BedHealthQO bedHealthQO);

    List<BedHealthDailyStatistics> getScoreByDate(  Integer bedId,   LocalDate startDate,  LocalDate endDate);

    IPage<HealthVO> searchHealthPageV1(HealthSearchParam param);

    BedHealthBreathDailyData getHealthReportV1(HealthDetailParam param);

    SleepReportVO getSleepReportOneV1(HealthDetailParam param);

    String getShareReportUrlV1(HealthDetailParam param, String baseUrl);

    BedHealthDailyStatistics selectOldHelthPage(Integer bedId);

    Object getHealthReportV2(HealthDetailParamV1 healthDetailParamV1);

    Object getHealthReportV3(HealthDetailParamV1 healthDetailParamV1);


    Object getReportInterpretation(HealthDetailParamV1 healthDetailParamV1);
    Object getReportInterpretationTest(HealthDetailParamV1 healthDetailParamV1);

    IPage<HealthVO> searchHealthPageList(HealthDetailParamV1 healthDetailParamV1);


    void exportHealthDataV1(HttpServletResponse httpServletResponse, HealthDetailParamV1 param);

    /**
     * 获取多日健康报告数据
     * @param bedHealthQO
     * @return
     */
    SleepReportMoreVO getReportMore4Hmp(Integer bedId, LocalDate startDate, LocalDate endDate);


    CommonRes<HealthReportDayVo> getH5SleepReportOneShare(String code);
}
